Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Re-connect to Zino server on lost connection #110

Merged
merged 12 commits into from
Jun 7, 2024

Conversation

podliashanyk
Copy link
Contributor

@podliashanyk podliashanyk commented Jun 7, 2024

Closes #94

It ain't pretty, but it fixes the bug:

  • If connection is lost with the Zino server, user is re-authenticated in Zino with existing credentials if user exists in session. An error alert is shown.
  • If connection is lost with the Zino server, and there is no user in existing session, user is redirected to /login for complete re-authentication.

@podliashanyk podliashanyk added bug Something isn't working beta Part of beta release labels Jun 7, 2024
@podliashanyk podliashanyk self-assigned this Jun 7, 2024
@codecov-commenter
Copy link

codecov-commenter commented Jun 7, 2024

Codecov Report

Attention: Patch coverage is 24.44444% with 34 lines in your changes missing coverage. Please review.

Please upload report for BASE (main@fedf6d3). Learn more about missing BASE report.

Files Patch % Lines
src/howitz/error_handlers.py 12.00% 22 Missing ⚠️
src/howitz/endpoints.py 14.28% 12 Missing ⚠️
Additional details and impacted files
@@           Coverage Diff           @@
##             main     #110   +/-   ##
=======================================
  Coverage        ?   48.37%           
=======================================
  Files           ?       15           
  Lines           ?      862           
  Branches        ?        0           
=======================================
  Hits            ?      417           
  Misses          ?      445           
  Partials        ?        0           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link

github-actions bot commented Jun 7, 2024

Test results

  4 files    4 suites   8s ⏱️
14 tests 14 ✔️ 0 💤 0
56 runs  56 ✔️ 0 💤 0

Results for commit a67309b.

♻️ This comment has been updated with latest results.

@podliashanyk podliashanyk changed the title Handle lost connection Re-connect to Zino server on lost connection Jun 7, 2024
src/howitz/endpoints.py Outdated Show resolved Hide resolved
src/howitz/error_handlers.py Outdated Show resolved Hide resolved
@podliashanyk podliashanyk requested a review from hmpf June 7, 2024 08:53
Comment on lines 83 to 87
if isinstance(e, BrokenPipeError):
current_app.logger.error("Lost connection to Zino server: %s", e)
else:
current_app.logger.error("Lost connection to Zino server: %s", e.args[0])

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Urgh, I meant: log with error in the else. logger.exception is fine for BrokenPipeError.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixup pushed

@podliashanyk podliashanyk merged commit 756673c into main Jun 7, 2024
5 checks passed
@podliashanyk podliashanyk deleted the handle-lost-connection branch June 7, 2024 11:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
beta Part of beta release bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

When connection to Zino server is temporarily lost, Howitz stops working until restarted
3 participants